export type SettingsData = {
  miniIOServer: string;
  m7sServerIp: string;
  softType?: SoftType;
  videoMatrixIp?: string;
  nickname?: string;
  serverIp?: string;
  screenshotWorkName?: string;
  obsPushServer: string;
};

export type OBSConfig = {
  outputWidth: number;
  outputHeight: number;
  fps: number;
  bitrate: number;
  encoder: string;
  recordPath: string;
};

export enum SoftType {
  ROOM = 'ROOM',
  ROOM_VIDEO_MATRIX = 'ROOM_VIDEO_MATRIX',
  OTHER = 'OTHER',
}

/**
 * 云台控制类型
 */
export enum PTZControlType {
  /**
   * 无
   */
  None = 'None',
  /**
   * 海康
   */
  HIK_VISION = 'HIK_VISION',
  /**
   * 全景摄像机
   */
  PANORAMIC_CAMERA = 'PANORAMIC_CAMERA',
  /**
   * 术野摄像机
   */
  FIELD_CAMERA = 'FIELD_CAMERA',
}

/**
 * 禁用类型
 */
export enum DisableType {
  /**
   * 禁用
   */
  On = 'On',
  /**
   * 启用
   */
  Off = 'Off',
}

/**
 * 设备类型
 */
export enum DeviceType {
  /**
   * 流媒体输出
   */
  StreamOutput = 'StreamOutput',
  /**
   * 媒体输入
   */
  MediaInput = 'MediaInput',
  /**
   * 媒体输出
   */
  MediaOutput = 'MediaOutput',
  /**
   * 摄像机输入
   */
  VideoCamera = 'VideoCamera',
  /**
   * 会议输入
   */
  ConferenceInput = 'ConferenceInput',
  /**
   * 会议输出
   */
  ConferenceOutput = 'ConferenceOutput',
}

/**
 * 输入源类型 monitor_capture 显示器输入 decklink-input 采集卡输入
 */
export type InputSourceType = 'monitor_capture' | 'decklink-input';

/**
 * 分屏类型
 */
export type SplitScreenMode =
  | '1x1'
  | '1x2'
  | '2x2'
  | 'LEFT1xRIGHT3'
  | 'LEFT1xRIGHT_BOTTOM1';

/**
 * 输入源可选参数
 */
export type InputSourceSettings = { [name: string]: any };

/**
 * 坐标
 */
export type Bounds = {
  x: number;
  y: number;
};

/**
 * 长宽
 */
export type Size = {
  width: number;
  height: number;
};

/**
 * 输入源参数
 */
export type InputSource = {
  //是否启用
  enabled: boolean;
  //名称
  readonly name: string;
  //设备值
  readonly value: string;
  //进程标识
  readonly workerName: string;
};

/**
 * 输出源参数
 */
export type OutputSource = InputSource & Bounds & Size;

/**
 * 输入源配置
 */
export type InputSourceConfig = InputSource & {
  /**
   * 显示名称
   */
  label: string;
  /**
   * 远程控制ip
   */
  remoteControlIp: string;
  /**
   * 远程控制用户名
   */
  remoteControlUsername: string;
  /**
   * 远程控制密码
   */
  remoteControlPassword: string;
  /**
   * 是否禁用
   */
  disabled: DisableType;
  /**
   * 设备类型
   */
  deviceType: DeviceType;
  /**
   * 云台类型
   */
  pTZControl: PTZControlType;
};

/**
 * 输出源配置
 */
export type OutputSourceConfig = OutputSource & {
  streamName?: string;
  /**
   * 显示名称
   */
  label: string;
  /**
   * 是否禁用
   */
  disabled: DisableType;
  /**
   * 设备类型
   */
  deviceType: DeviceType;
  /**
   * 分屏参数
   */
  splitScreenMode: SplitScreenMode;
  /**
   * 投影配置
   */
  previewConfig: [
    PreviewWindowParams?,
    PreviewWindowParams?,
    PreviewWindowParams?,
    PreviewWindowParams?,
  ];
};

/**
 * 预览窗口配置
 */
export type PreviewWindowParams = {
  /**
   * 输入源进程名称
   */
  inputSourceName: string;
  /**
   * 预览窗口id
   */
  previewWindowId: string;
};

/**
 * 创建预览窗口参数
 */
export type PreviewWindowOptions = Bounds &
  Size & {
    /**
     * 预览窗口id
     */
    previewWindowId: string;
  };

/**
 * 输入输出源启动参数
 */
export type InputParams = {
  /**
   * 启动就推流
   */
  startPush: boolean;
  /**
   * 采集输入类型
   */
  id: InputSourceType;
  /**
   * 采集可选参数
   */
  inputSourceSettings: InputSourceSettings;
  /**
   * 发送音频设备id
   */
  sendAudioDeviceId?: string;
  /**
   * 接收音频设备id
   */
  receiveAudioDeviceId?: string;
  /**
   * 监听音频
   */
  //0不监听 1监听并静音 2监听并输出
  receiveAudioDeviceMonitoringType?: 0 | 1 | 2;
  /**
   * 坐标
   */
  bounds?: Bounds;
  /**
   * 宽高
   */
  size?: Size;
};

/**
 * 文件参数
 */
export type FileType = {
  /**
   * 文件名称
   */
  fileName: string;
  /**
   * 文件大小
   */
  size: number;
};

/**
 * 网卡参数
 */
export type NetworkInterfacesData = {
  iface: string;
  ifaceName: string;
  ipv4: string;
  ipv4subnet: string;
  ipv6: string;
  mac: string;
  dhcp: 'true' | 'false';
  gateway: string;
  dhcpServer: string;
  dnsServer: string;
};

/**
 * 音频参数
 */
export type AudioSettings = {
  /**
   * 发送音频设备
   */
  send?: InputSource;
  /**
   * 接收音频设备
   */
  receive?: InputSource;
  /**
   * 扬声器 音频输出配置
   */
  audioOutput?: string;
};

export type Patient = {
  id: number;
  name: string;
  sex: number;
  age: number;
  hospitalNumber: string;
  operationTime: string;
  department: string;
  doctor: string;
  operationRoomNo: string;
  operateCarNum: string;
  equipmentName: string;
  createTime: string;
};

export type User = {
  id: number;
  nickname: string;
  username: string;
  password: string;
  role: string;
  createTime: string;
};
export type RecordFile = {
  id: string;
  fileName: string;
  filePath: string;
  fileUrl: string;
};

export type InputSourceSelectType = {
  id: string;
  senceItemId: string | number;
  name?: string;
  visible?: boolean;
};

export type ISort = {
  sort: number;
};
// export type InputSourceSettings = { [name: string]: any };
export type InputSourceModelType = {
  id: string;
  sceneItemId: number;
  name: string; //显示的名字
  aliasName: string; //别名 唯一id
  type: string;
  x: number;
  y: number;
  scaleX: number;
  scaleY: number;
  visible: boolean;
  locked: boolean;
  selected: boolean;
  settings: InputSourceSettings;
} & ISort;
export type SceneModelType = {
  name: string;
  selected: boolean;
  items: InputSourceModelType[];
} & ISort;

export type osnSelectType = {
  selectSource: InputSourceModelType;
  selectScene: SceneModelType;
};

type obsCategory = { [name: string]: obsCategory };
export type saveModelType = {
  sceneList: SceneModelType[];
  audioList: any[];
  defaultTransition: {
    type: string;
    timer: number;
  };
  obsSetting: {
    customer: any;
    obs: obsCategory;
  };
};

//盒子配置
export type mixOutputSource = {
  outputSource: mixConfig[];
};

export type mixConfig = {
  mixConfig: mixType[];
  mixType: number;
};
export type mixType = { address: string; volume: number; port: number };

export type responseType<T> = {
  success: boolean;
  data: T;
};

export type liveControlRecordType = {
  id: number;
  liveDataId: number;
  selfGrouthId: number;
  m7sRecordId: string;
};
export type receivedType = {
  sceneName: string;
  name: string;
  updateSettings: any;
};
export type modalData = {
  path: string;
  data: any;
  title?: string;
  showClose?: boolean;
};
export type RecordDataType = {
  patientId: number;
  fileName: string;
  fileUrl: string;
  fileTime?: string;
  fileSize?: string;
  fileType: number;
  recordTimeNode?: string;
  recordTime?: string;
  uploadType: number;
  m7sRecordId: string;
  recordEquipmentIp: string;
  recordType: number;
};
